package br.edu.ufcg.lp2;


/**
 * This class represents a vote of a name, characterized by three options: like,
 * halflike and dislike.
 * 
 * @author João Pedro Leôncio <joopeeds@gmail.com>
 * @author Franco Stefano <stefano.tejo@gmail.com>
 * @author Fellype Cavalcante <fellype.cavalcante@gmail.com>
 */


public class Vote {

	private int rating;
	private User user;
	
	public static final int LIKE = 1;
	public static final int HALFLIKE = 0;
	public static final int DISLIKE = -1;
	
	
	/**
	 * 
	 * @param rating
	 * 		The rating itself
	 * @param user
	 * 		The user itself
	 * @throws Exception
	 * 		If the rating pass the limits.
	 */
	
	
	public Vote(int rating, User user) throws Exception {
		if(rating > 1 || rating < -1) throw new Exception("Rating should be an integer between -1 and 1 (included)");
		this.rating = rating;
		this.user = user;
	}


	/**
	 *  Gets the vote
	 *  @return 
	 *  	The Vote
	 */

	
	public int getRating() {
		return rating;
	}

	/**
	 * Gets the user
	 * @return
	 * 		The User
	 */


	public User getUser() {
		return user;
	}

	
	
	
	
	
	
}
